package demo5;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.nextLine();
        List<String> list = new ArrayList<>();
        int i = 0,n = s.length();
        while (i<n) {
            while (i<n && !Character.isAlphabetic(s.charAt(i))) {
                i++;
            }
            int j = i;
            while (j<n && Character.isAlphabetic(s.charAt(j))) {
                j++;
            }
            String word = s.substring(i,j);
            list.add(word);
            i = j+1;
        }
        Collections.reverse(list);
        for(String x : list) {
            System.out.print(x + " ");
        }
    }
}
